<template>
	<view class="page">
		<view class="tit">
			<view class="tit-list zan" :class="{'active':isActive==1}" @click="showModel(1)">
				点赞
			</view>
			<view class="tit-list ask" :class="{'active':isActive==2}" @click="showModel(2)">
				评论/回复
			</view>
			<view style="display: none;" class="tit-list act" :class="{'active':isActive=='3'}" @click="showModel('3')">
				活动
			</view>
	<!-- 		<view class="tit-list new" :class="{'active':isActive=='4'}" @click="showModel('4')">
				通知
			</view> -->
		</view>
		<!-- 点赞 -->
		<view class="list-1" v-if="isActive=='1'">
			<view class="no-msg-box" v-if="like_list.length<1">
				<image lazy-load="true"  src="../../static/images/nomsg.png" mode="widthFix" class="no-msg"></image>
			</view>
			<!--  -->
			<view class="list-1-item" v-for="(item,key) in like_list" :key="key">
				<view class="list-1-item-left">
					<image lazy-load="true"  :src="item.user_info.base_avatar" class="tit-img"></image>
					<view class="msg">
						<view class="">{{item.user_info.base_nickname}}</view>
						<view class="enter">
							<image lazy-load="true"  src="../../static/images/taoxin.png" class="xin"></image>
							<view class="">【{{item.note.title}}】</view>
						</view>
						<view class="time">
							{{ utils.timeTodate('Y-m-d H:i', item.create_time*1000) }}
						</view>
					</view>
				</view>
				<!-- <view class="list-1-item-right">
					<image lazy-load="true"  src="../../static/images/goods1.png" class="goods"></image>
				</view> -->
			</view>
			<!--  -->
			
		</view>
		
		<!-- 评论/回复 -->
		<view class="list-1" v-if="isActive=='2'">
			<view class="no-msg-box" v-if="comment_list.length<1">
				<image lazy-load="true"  src="../../static/images/nomsg.png" mode="widthFix" class="no-msg"></image>
			</view>
			<view class="list-1-item" v-for="(item,key) in comment_list" :key="key">
				<view class="list-1-item-left">
					<image lazy-load="true"  :src="item.user_info.base_avatar" class="tit-img"></image>
					<view class="msg">
						<view class="">{{item.user_info.base_nickname}}</view>
						<view class="enter">
							<view class="">【{{item.note.title}}】</view>
						</view>
						<view class="des">
							{{item.comment.content}}
						</view>
						<view class="time">
							{{ utils.timeTodate('Y-m-d H:i', item.comment.create_time*1000) }}
						</view>
					</view>
				</view>
				
			</view>
		
	
			
	
			
		</view>
		
		<!--  活动开始  -->
		<!-- 暂时不做 -->
		<view class="list-2"  v-if="isActive=='3'">
			<view class="list-2-item">
				<image lazy-load="true"  src="" mode=""></image>
			</view>
			
		</view>
		<!--  活动结束  -->
		
		<!--  通知开始 -->
		<view class="list-3"  v-if="isActive=='4'">
			<view class="list-3-item">
				<view class="box">
					<image lazy-load="true"  src="../../static/images/img1.png" class="new-img"></image>
					<view class="new-box">
						<view class="new-tit">服务通知</view>
						<view class="new-msg">亲爱的你慢慢回，小心前面带刺的玫瑰亲爱的你慢慢回，小心前面带刺的玫瑰</view>
					</view>
				</view>
				<view class="time">
					昨天
				</view>
			</view>
			
			<view class="list-3-item">
				<view class="box">
					<image lazy-load="true"  src="../../static/images/img1.png" class="new-img"></image>
					<view class="new-box">
						<view class="new-tit">服务通知</view>
						<view class="new-msg">亲爱的你慢慢回，小心前面带刺的玫瑰亲爱的你慢慢回，小心前面带刺的玫瑰</view>
					</view>
				</view>
				<view class="time">
					昨天
				</view>
			</view>
			
			<view class="list-3-item">
				<view class="box">
					<image lazy-load="true"  src="../../static/images/img1.png" class="new-img"></image>
					<view class="new-box">
						<view class="new-tit">服务通知</view>
						<view class="new-msg">亲爱的你慢慢回，小心前面带刺的玫瑰亲爱的你慢慢回，小心前面带刺的玫瑰</view>
					</view>
				</view>
				<view class="time">
					昨天
				</view>
			</view>
			
			<view class="list-3-item">
				<view class="box">
					<image lazy-load="true"  src="../../static/images/img1.png" class="new-img"></image>
					<view class="new-box">
						<view class="new-tit">服务通知</view>
						<view class="new-msg">亲爱的你慢慢回，小心前面带刺的玫瑰亲爱的你慢慢回，小心前面带刺的玫瑰</view>
					</view>
				</view>
				<view class="time">
					昨天
				</view>
			</view>
			
			<view class="list-3-item">
				<view class="box">
					<image lazy-load="true"  src="../../static/images/img1.png" class="new-img"></image>
					<view class="new-box">
						<view class="new-tit">服务通知</view>
						<view class="new-msg">亲爱的你慢慢回，小心前面带刺的玫瑰亲爱的你慢慢回，小心前面带刺的玫瑰</view>
					</view>
				</view>
				<view class="time">
					昨天
				</view>
			</view>
		</view>
		<!--  通知结束 -->
		
	</view>
</template>

<script>
	import utils from '@/components/shoyu-date/utils.filter.js';
	export default {
		data() {
			return {
				isActive:1,
				like_p:1,
				comment_p:1,
				per:20,
				utils: utils,
				like_list:[],
				comment_list:[],
				is_load:false
				
			}
		},
		onShow() {
			var self = this;
			self.comment_list=[];
			self.like_list=[];
			this.getLikeList();
			this.getCommentList();
			// #ifdef H5
			let share_time_line={
				title:self.$request.h5_share_name, // 分享标题
				link: self.$request.h5_share_url+'?page=index', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
			}
			let share_app_message={
				title: self.$request.h5_share_name, // 分享标题
				desc: '我发现了一个很不错的商城，买家具有超大实惠！', // 分享描述
				link: self.$request.h5_share_url+'?page=index', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
			}
			uni.setStorageSync('share_time_line',share_time_line);
			uni.setStorageSync('share_app_message',share_app_message);
			self.$request.wx_config()
			// #endif
		},
		onShareAppMessage(res) {
		    if (res.from === 'button') {
		      console.log(res.target)
		    }
		    return {
		      title: this.$request.share_title,
		      path: '/pages/index/index'
		    }
		  },
		methods: {
			showModel(num){
				var self = this;
				self.isActive = num;
			},
			getLikeList(){
				var self = this;
				this.$request.request({
					url:'/user/like/list',
					data:{
						p:this.like_p,
						per:this.per
					},
					success:function(res){
						if(res.code==200){
							var  y = res.result;
							self.is_load = false;
							if(y.data.length<1){
								return;
							}
							self.like_list = self.like_list.concat(y.data);	
						}else{
							
						}
					}
				});
			},
			getCommentList(){
				var self = this;
				this.$request.request({
					url:'/user/comment/list',
					data:{
						p:this.comment_p,
						per:this.per
					},
					success:function(res){
						if(res.code==200){
							var  y = res.result;
							self.is_load = false;
							if(y.data.length<1){
								return;
							}
							self.comment_list = self.comment_list.concat(y.data);
						}else{
							
						}
					}
				});
			}
		},
		onReachBottom(){
			var self = this;
			if(this.is_load) return;
			this.is_load = true;
			if(self.isActive==1){
				self.like_p++;
				this.getLikeList();
			}
			if(self.isActive==2){
				self.comment_p++;
				this.getCommentList();
			}
		}
	}
</script>

<style>
	@import url("news.css");
</style>
